package pub.tbc.rubbish.demo2.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import pub.tbc.rubbish.client.factory.ObjectFactory;
import pub.tbc.toolkit.http2.template.HttpTemplate;

import java.util.Map;

/**
 * @author tbc on 2016/12/13 11:04:04.
 */
@Slf4j
@RestController
public class Demo2Controller {

    @GetMapping("demo")
    public Map<String, Object> demo() {
        HttpTemplate http = new HttpTemplate();
        String url = "http://" +
                ObjectFactory.getDiscovery().discover("demoController.demo") +
                "/demo1/demo1";

        Map<String, Object> map = HttpTemplate.get(url, Map.class);
        log.info("response : ", map);
        return map;
    }
}
